<?php
namespace app\admin\controller;

use think\Session;

class Upload extends Action
{
   
    
   public function ckKindImage(){
    	$imgpath= "";
        $file = request()->file('upload');        
        if($file){            
    	   $imgpath = model("Upload")->aUpload($file); 
    	}
       return json(['uploaded'=>true,'url'=>'/'.$imgpath]);
      
    }

    public function TempUpload(){
    	$imgpathArr=[];
    	if(request()->file('files')){   
          $imgpathArr = model('Upload')->uploadTemp(request()->file('files'));  
		}
		$typesRes = model("Type")->getType();
		return json(["code"=>200,"data"=>$imgpathArr]);
    }

    public function Delete(){
    	if(is_file("./".input('img'))){
    		@unlink("./".input('img'));
    		return json(["code"=>200]);   
    	}else{
    		return json(["code"=>100]);   
    	}
    }
}

